﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WS.DAL
{
    public abstract class SanphamDAL : BaseDAL, IBase
    {
        public int Count()
        {
            throw new NotImplementedException();
        }

        public object Select(string code)
        {
            throw new NotImplementedException();
        }

        public System.Data.DataTable Select(Guid fKey)
        {
            throw new NotImplementedException();
        }

        public System.Data.DataTable Select(object obj = null, int skip = 0, int take = 0)
        {
            return Mapper.QueryForDataTable("Sanpham_Select", null);
        }

        public object Insert(object obj)
        {
            return _sqlMapper.Insert("Sanpham_Insert", obj);
        }

        public object Update(object obj)
        {
            return _sqlMapper.Update("Sanpham_Update", obj);
        }

        public object Delete(Guid id = new Guid())
        {
            return _sqlMapper.Delete("Sanpham_Delete", id);
        }

        public System.Data.DataTable Layma()
        {
            return Mapper.QueryForDataTable("Sanpham_Layma", null);
        }

        //Tìm kiếm
        //Theo loại
        public System.Data.DataTable Sanpham_Tim_Loai(Guid Loai_Id)
        {
            return Mapper.QueryForDataTable("Tim_Loai", Loai_Id);
        }

        //Theo NSX
        public System.Data.DataTable Sanpham_Tim_NSX(Guid NSX_Id)
        {
            return Mapper.QueryForDataTable("Tim_NSX", NSX_Id);
        }

        //Tìm theo tên sp
        public System.Data.DataTable Sanpham_Tim_Ten(string Ten)
        {
            return Mapper.QueryForDataTable("Tim_Ten", Ten);
        }

        //Tìm theo Id sản phẩm
        public System.Data.DataTable Sanpham_Tim_Id(Guid Id)
        {
            return Mapper.QueryForDataTable("Tim_Id", Id);
        }
    }
}
